home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 1998 May
/
Software of the Month Club 1998 May.iso
/
pc
/
dos
/
child
/
poetry
/
readme.txt
< prev
next >
Wrap
Text File
|
1998-03-03
|
9KB
|
235 lines
**************************************************************************
*+----------------------------------------------------------------------+*
*| |*
*| Random Poetry Generator |*
*| Version 1.01 - November 1997 |*
*| |*
*+----------------------------------------------------------------------+*
**************************************************************************
+------------------------------------------------------------------------+
| What is it? |
+------------------------------------------------------------------------+
It is simply a program that generates random poetry.
+------------------------------------------------------------------------+
| Installing |
+------------------------------------------------------------------------+
Installing the program is dead simple. All you do is create a directory on
your computer and then extract the archive into it.
+------------------------------------------------------------------------+
| Running |
+------------------------------------------------------------------------+
This is pretty simple as well. Go to the command prompt, set the current
directory to the install directory and then type POET. You should find
a randomly generated poem on your computer screen. To generate the next
one press enter. To quit, press Q.
If you run the code without giving it any arguments it will load up the
file poet.txt and generate its poems from that. If you want to have more
control over the poems generated you can change the file it uses and you
can also change various parameters used in generating the poems. Here is
a summary of the command line options of the program:
POETRY <filename> options
The options can be any of the following
-lnn Changes the number of lines per poem to nn. The default is 6
-wnn Sets the number of characters per line to nn. The default is 60
-snn Seeds the random number generator to the given value. Normally it
is seeded from the clock.
If you want to get a help screen at any time you just run the program with
the argument ?.
+------------------------------------------------------------------------+
| Changing poet data |
+------------------------------------------------------------------------+
The data used to generate the poems is contained in the data file that you
give the program. This data file is a normal text file and contains within
it data on the verbs & nouns used. There are 4 sections in this file and
they are organised like this:
~~~~~~~~~~~~
&NOUNS
-->data for nouns goes here
&ENDNOUNS
&VERBS
-->data for verbs goes here
&ENDVERBS
&QUALITIES
-->data for qualities goes here
&ENDQUALITIES
&EXCLAMATIONS
-->data for exclamations goes here
&ENDEXCLAMATIONS
~~~~~~~~~~~~
Here is an in depth description of what goes in each section:
NOUNS
-----
The best way to understand how nouns are done is to look at an
example:
The postman(he)/person/man/
the first part of the data gives the actual string that will be printed in
the poem. It begins at the start of the line and end with "(". The data
within the brackets gives the type of person the noun is. This can be one
of the following: he, she, it, they, we or i. The next part of the data
is a list of descriptors saying what type of thing this noun actuallyis.
Each desriptor is a word contained within forward slashes. These
descriptors can be any old thing you like but they must match up with the
descriptors used in the verb defintions. (See below).
VERBS
-----
Here is an excerpt from some verb data
/person/thing/
stole
sat upon
coveted
/person/animal/
ate
tamed
ran away from
The verbs are split into sections. The start of a section says what sort
of thing the verbs to follow can have as a subject and object. In case you
dont understand the terms "subject" and "object", basically the
subject is the thing doing the verb and the object is the thing having the
verb done to it. For example in the sentence "the man ate the sandwich",
"the man" is the subject and "the sandwich" the object. The type of things
given as subject and object should match up with the descriptors given for
the nouns.
When the program uses these verbs, it will put the subject at the start,
followed by the verb and then the subject. For example if you had these
two nouns as subject and object repsectively:
the postman(he)/person/man/
the car(it)/thing/
Then using the verb data above, the program might put togethor the lines
The postman |stole |the car
or:
The postman | coveted | the car
EXCLAMATIONS
------------
Exclamation are just phrase like "and lo" or "and so it was that", that
are randomly stuck at the beginning of lines. These are given one per
line between &EXCLAMATIONS & &ENDEXCLAMATIONS
QUALITIES
---------
Qualities are specified in the following way:
/person/
teeth
arms
sarcasm
/thing/
size
What these things are is things that can be posessed by nouns. For example
if you are talking about a thing of type /person/ then they can posess for
example teeth, arms or sarcasm. The way the program uses these qualities
is ever so often instead of using a noun directly it will replace it with
a thing that is posessed by that noun. For example, as "The postman"
above has a type /person/ the program might replace postman with
"his | teeth" or "his | arms" or "his | sarcasm".
The rest of the data for a quality is specified in exactly the same way as
a noun.
MORE ADVANCED STUFF
-------------------
To jazz up verbs a bit, there are various "keys" that you can stick in
them which when the sentence is expanded will be replaced by various
key phrases. All these "keys" begin with an asterix and have no space
in them. Here is a list of the keys and what they get replaced by:
KEY WHAT IT GETS REPLACED BY EXAMPLE FOR NOUN
"the postman"
--------------------------------------------------------------------
*sub Subject of verb the postman
*obj Object of verb the postman
*psub Possesive form of subject his
*pobj Posessive form of object his
*ref Reflexive form of subject himself
Normally the program assumes that there is a *sub and *obj key at the
beginning of the sentence but by putting in the *sub and *obj keys you
can override this behaviour.
So you can better understand this, here is an example. Suppose we have
the following subject and object:
the postman(he)/person/
the kerb(it)/abstract/
and the verb is:
*sub stubbed *psub toe on *obj and felt sorry for *ref
Then the following substitutions will take place:
*sub -> the postman
*psub -> his
*obj -> the kerb
*ref -> himself
So the expanded line would come out as:
"the postman stubbed his toe on the kerb and felt sorry for himself"
If however we changed the subject to
the woman(she)/person/
then the line would be expanded to:
"the woman stubbed her toe on the kerb and felt sorry for herself"
+------------------------------------------------------------------------+
| The Source |
+------------------------------------------------------------------------+
If you have played around with the code for a bit and thought "well this
is all very nice but it could be twice as good if there were a few changes
made here and there", well now you can make the changes yourself. Within
this archive you should find a file main.c containing the complete source.
I have tried to make the code completely ANSI C compliant so hopefully you
should be able to compile it on any old C compiler.
+------------------------------------------------------------------------+
| About |
+------------------------------------------------------------------------+
This program was written by Paul Gaze. If you want to get in contact with
me you can do so over email at the address:
pgaze@pgaze.demon.co.uk
You can also visit my web page which can be found at:
http://www.pgaze.demon.co.uk/index.htm